package com.dzk.cp.c11x5.index.cs.by;

import java.util.List;

import com.dzk.cp.c11x5.index.zx.cs.ZXnCSIndex;
import com.dzk.cp.c11x5.pojo.R5;

public abstract class CsByxZXnIndex extends CsByxIndex {
	
	protected CsByxZXnIndex setParams(int code, int num, int unit, String xc) {
		super.setParams(code, num, unit, xc);
		return this;
	}
	
	@Override
	protected Integer getCS(List<? extends R5> r5s, String xc) {
		return ZXnCSIndex.getCS(r5s, xc);
	}

	public static CsByxZXnIndex getInstance(int code, int num, int unit, String xc) {
		int n = (xc.length() + 1) / 3;
		switch (n) {
//		case 1:
//			return new CsByxZX1Index().setParams(code, num, unit, xc);
		case 2:
			return new CsByxZX2Index().setParams(code, num, unit, xc);
		case 3:
			return new CsByxZX3Index().setParams(code, num, unit, xc);
		default:
			return null;
		}
	}

}

class CsByxZX1Index extends CsByxZXnIndex {

	@Override
	protected int getZQ() {
		return 11;
	}
	
}

class CsByxZX2Index extends CsByxZXnIndex {

	@Override
	protected int getZQ() {
		return 110 / 2;
	}
	
}

class CsByxZX3Index extends CsByxZXnIndex {

	@Override
	protected int getZQ() {
		return 990 / 6;
	}
	
}
